package com.base.self.dto.commodity;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class CommodityWebUpdateDTO implements Serializable {

    @ApiModelProperty(value = "ID自增长（商品编号）")
    @NotNull(message = "商品编号不能为空")
    private Integer id;

    @ApiModelProperty(value = "商品名称")
    @NotBlank(message = "商品名称不能为空")
    private String commodityName;

    @ApiModelProperty(value = "实付价")
/*    @NotNull(message = "实付价不能为空")*/
    @DecimalMin(message = "实付价为正数", value = "0.01")
    private BigDecimal commodityRealPrice;

    @ApiModelProperty(value = "市场价")
    @NotNull(message = "市场价不能为空")
    @DecimalMin(message = "市场价为正数", value = "0.01")
    private BigDecimal commodityMarketPrice;

    @ApiModelProperty(value = "规格")
    @NotBlank(message = "规格不能为空")
    private String commodityStandard;

    @ApiModelProperty(value = "库存")
    @NotNull(message = "库存不能为空")
    @Min(message = "库存为正整数", value = 1)
    private Integer commodityStock;

    @ApiModelProperty(value = "商品分区 0: 奖励金区 1：积分")
    @NotNull(message = "商品分区不能为空")
    @Range(min = 0, max = 1, message = "商品分区只能为0或1")
    private Integer commoditySubarea;

    @ApiModelProperty(value = "商品一级分类")
    @NotNull(message = "商品一级分类不能为空")
    private Integer commodityClassifyLevel1;

    @ApiModelProperty(value = "商品二级分类")
    private Integer commodityClassifyLevel2;

    @ApiModelProperty(value = "商品展示图片")
    @NotBlank(message = "商品展示图片不能为空")
    private String commodityShowPic;

    @ApiModelProperty(value = "商品轮播图1")
    @NotBlank(message = "商品轮播图1不能为空")
    private String commoditySlidePic1;

    @ApiModelProperty(value = "商品轮播图2")
    @NotBlank(message = "商品轮播图2不能为空")
    private String commoditySlidePic2;

    @ApiModelProperty(value = "商品轮播图3")
    @NotBlank(message = "商品轮播图3不能为空")
    private String commoditySlidePic3;

    @ApiModelProperty(value = "说明")
    private String commodityExplain;

    @ApiModelProperty(value = "详情")
    private String commodityContextDetails;

    @ApiModelProperty(value = "拼团过期时间(小时)")
//    @NotNull(message = "拼团过期时间不能为空")
//    @Min(message = "拼团过期为正整数", value = 1)
    private Integer expirationHour;

    @ApiModelProperty(value = "话费礼包id")
    @NotNull(message = "话费礼包id不能为空")
    private Integer callPlan;

    @ApiModelProperty(value = "销量")
    private Integer commoditySales;
    @ApiModelProperty(value = "是否可被购买 0否1是")
    private Integer buy;
}
